switch: Don't include margins in input window size
authorTimm Bäder <mail@baedert.org>
Tue, 12 Jan 2016 20:36:37 +0000 (21:36 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 12 Jan 2016 20:56:53 +0000 (21:56 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=760509

gtk/gtkswitch.c

index 8c1616faea5a975be691f77141c69306aefd3977..9f6f6596ba8fb3b7660276cd84e725fed4180757 100644 (file)
@@ -485,6 +485,17 @@ gtk_switch_allocate_contents (GtkCssGadget        *gadget,
                            &slider_alloc,
                            baseline,
                            out_clip);
+
+  if (gtk_widget_get_realized (GTK_WIDGET (self)))
+    {
+      GtkAllocation border_allocation;
+      gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL);
+      gdk_window_move_resize (priv->event_window,
+                              border_allocation.x,
+                              border_allocation.y,
+                              border_allocation.width,
+                              border_allocation.height);
+    }
 }
 
 static void
@@ -495,19 +506,11 @@ gtk_switch_size_allocate (GtkWidget     *widget,
   GtkAllocation clip;
 
   gtk_widget_set_allocation (widget, allocation);
-
-  if (gtk_widget_get_realized (widget))
-    gdk_window_move_resize (priv->event_window,
-                            allocation->x,
-                            allocation->y,
-                            allocation->width,
-                            allocation->height);
-
   gtk_css_gadget_allocate (priv->gadget,
                            allocation,
                            gtk_widget_get_allocated_baseline (widget),
                            &clip);
-  
+
   gtk_widget_set_clip (widget, &clip);
 }